﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace iNet.Win32
{
	/// <summary>
	/// 提供 Shell32.dll 的 Windows API 函式。
	/// </summary>
	public static class Shell32
	{
		#region ShellExecute
		[DllImport("Shell32", CharSet = CharSet.Unicode)]
		public static extern IntPtr ShellExecute(
			IntPtr hwnd,
			[MarshalAs(UnmanagedType.LPTStr)]string lpOperation,
			[MarshalAs(UnmanagedType.LPTStr)]string lpFile,
			[MarshalAs(UnmanagedType.LPTStr)]string lpParameters,
			[MarshalAs(UnmanagedType.LPTStr)]string lpDirectory,
			SW nShowCmd);
		#endregion
		#region ShellExecuteEx
		[DllImport("Shell32", SetLastError = true, CharSet = CharSet.Unicode)]
		public static extern bool ShellExecuteEx(ref SHELLEXECUTEINFO pExecInfo);
		#endregion
		#region SHFileOperation
		[DllImport("Shell32", SetLastError = true)]
		public static extern int SHFileOperation(ref SHFILEOPSTRUCT lpFileOp);
		#endregion
		#region SHGetFileInfo
		[DllImport("Shell32", SetLastError = true)]
		public static extern IntPtr SHGetFileInfo(string pszPath, FileAttributes dwFileAttributes, out SHFILEINFO psfi, int cbFileInfo, SHGFI uFlags);
		#endregion
		#region SHGetKnownFolderPath
		[DllImport("shell32", SetLastError = true)]
		public static extern IntPtr SHGetKnownFolderPath(ref Guid rfid, uint dwFlags, IntPtr hToken, out IntPtr ppszPath);
		#endregion
	}
}
